import QtQuick 2.0
import QtQuick.Controls 2.12
import QtGraphicalEffects 1.12
Popup{
    id:mySecenesPopup
    width: 600
    height: 332
    closePolicy: Popup.CloseOnEscape
    // 设置背景为透明
    background: Rectangle {
        color: "#1F2A37"
    }
    property var is_ok:false
    Rectangle{
        anchors.fill: parent
        color: "transparent"
        Image{
            anchors.top:parent.top
            anchors.horizontalCenter: parent.horizontalCenter
            width: is_ok ? 120 : 80
            height: is_ok ? 120 : 80
            source: is_ok ? "qrc:/scraper/imgs/ok_view.png":"qrc:/scraper/imgs/warn.png"
        }
        Text{
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.top: parent.top
            anchors.topMargin: 144
            text: is_ok ? "您已完成视野检查通过，车辆周围安全" :"车辆周围不安全，请及时处理！"
            color:  is_ok ?"#F1F1F1" :"#F05252"
            font{
                family: "Microsoft YaHei"
                pixelSize: 32 
            }
        }
        Rectangle{
            width: 320
            height: 80
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.bottom: parent.bottom
            radius: 10
            color: is_ok ? "#2D8CFE":"#262D8CFE"
            Text{
                anchors.centerIn: parent
                text: "开始远程驾驶"
                color:  is_ok ?"#FFFFFF" :"#26FFFFFF"
                font{
                    family: "Microsoft YaHei"
                    pixelSize: 30 
                }
            }
            MouseArea{
                anchors.fill: parent
                onClicked: {
                    if(is_ok)
                    {
                        sceneRect.startDrive()
                        mySecenesPopup.close()   
                    }
                }
            }
        }
    }

}